import time


def read2list(filename):
    n = 5000
    file = open(filename, 'r')
    data = file.readlines()
    t_start = time.time()
    f = True
    while f:
        f = False
        i = 0
        for j in range(n - 1 - i):
            if data[j] > data[j + 1]:
                data[j], data[j + 1] = data[j + 1], data[j]
                f = True
        i += 1
    t_finish = time.time()
    print(f"{filename} {round((t_finish - t_start) * 1000)} millisecond")


m1 = read2list("m1_sorted.txt")
m2 = read2list("m2_reverse.txt")
m3 = read2list("m3_shuffle.txt")
